package com.qc.serviceedu.controller.front;


import com.qc.commonutils.result.R;
import com.qc.serviceedu.entity.EduCourse;
import com.qc.serviceedu.entity.EduTeacher;
import com.qc.serviceedu.service.EduCourseService;
import com.qc.serviceedu.service.EduTeacherService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "前端热门名师和课程")
@RestController
@CrossOrigin
@RequestMapping("/eduservice/indexfront")
public class IndexFrontController {

    @Autowired
    private EduCourseService courseService;

    @Autowired
    private EduTeacherService teacherService;

    //查询前8课程，前4名师
    @GetMapping("index")
    public R index(){
        List<EduCourse> courseList = courseService.CourseList();
        List<EduTeacher> teacherList = teacherService.TeacherList();
        return R.ok().data("courseList",courseList).data("teacherList",teacherList);
    }
}
